


//
//  LJHColTableViewCell.m
//  HEARME
//
//  Created by 曲政永 on 16/1/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHColTableViewCell.h"
#import "LJHColCollectionViewCell.h"
@interface LJHColTableViewCell ()<UICollectionViewDataSource,UICollectionViewDelegate>
@end

@implementation LJHColTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createCell];
    }
    return self;
}

-(void)createCell
{
    
    UICollectionViewFlowLayout *recLayout = [[UICollectionViewFlowLayout alloc]init];
    recLayout.itemSize = CGSizeMake(200, 60);
    recLayout.sectionInset = UIEdgeInsetsMake(10, 0, 10, 0);
    self.cateCollectionView = [[LJHBaseCollectionView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, WIDTH) collectionViewLayout:recLayout];
    [self.contentView addSubview:self.cateCollectionView];
//    self.cateCollectionView.backgroundColor = [UIColor whiteColor];
    self.cateCollectionView.delegate = self;
    self.cateCollectionView.dataSource = self;
    [self.cateCollectionView registerClass:[LJHColCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    
    
    
    
    
}
//-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionViewÓ
//{
//    return 10;
//}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    
    return (self.cateArray.count-5);
    
    
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    LJHColCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.cateModel = [self.cateArray objectAtIndex:indexPath.row+5];
    
    return cell;
}

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
//    TOCategoryScrollViewController *categorySVC = [[TOCategoryScrollViewController alloc] init];
//    [(TOTabBarController*)self.tabBarController isHiddenTabBar:YES withViewController:categorySVC];
//    categorySVC.categoryId = ((TOCategoryModel *)self.categoryArray[indexPath.item]).itemKey;
//    [self.navigationController pushViewController:categorySVC animated:YES];
    LJHCateModel *cateModel = [self.cateArray objectAtIndex:(indexPath.row+5)];
//    [(LJHTabBarViewController *)self.tabBarController isHiddenTabBar:YES withViewController:musicListVC];
    [self.myPushCollect pushCollest:cateModel.cateId];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
